function isSame(o1, o2) {
  //先获取数据类型
  let type1 = Object.prototype.toString.call(o1);
  let type2 = Object.prototype.toString.call(o2);
  if (type1 !== type2) {
    return false;
  }
  //如果是数组先比较length
  if (Array.isArray(o1)) {
    let len1 = o1.length;
    let len2 = o2.length;
    if (len1 !== len2) {
      return false;
    }
    return o1.every((item, idx) => isSame(item, o2[idx]));
  }

  if (type1 === "[object Object]") {
    if (Object.keys(o1).length !== Object.keys(o2).length) {
      return false;
    }
    for (let key in o1) {
      if (!o2.hasOwnProperty(key)) {
        console.log(key, o2);
        return false;
      }

      if (!isSame(o1[key], o2[key])) {
        return false;
      }
    }
    return true;
  }
  return o1 === o2;
}

let o1 = { a: 111, b: [1, 2, 3], c: [1111],d: [1111] };
let o2 = { a: 111, b: [1, 2, 3], d: [1111],c: [1111] };

console.log(isSame(o1, o2));
// console.log(new Date("2022/9/8") == new Date("2022/9/8"));


function NumFormat(str) {
  if (typeof str === "number" && !isNaN(str)) {
    str = String(str);
  }
  const reg = /(?!^)(?=(\d{3})+$)/g;
  // console.log(str.match(reg))
  return str.replace(reg, ",");
}


console.log(NumFormat(123445));


